﻿Imports System.Data
Imports System.Data.OleDb
Imports geraLaudosAutomatico.conexao
Imports System.Text

Public Class armaDAO

    Dim sql As New StringBuilder
    Dim i As Integer

    Public Function getArmas() As Generic.List(Of armaVO)


        Dim arma As New armaVO
        Dim objConn As New conexao
        '  Dim item As New autoridadeVO With {.ID_AUTORIDADE = -1, .NOME_AUTORIDADE = "Selecio


        sql.Clear()
        sql.Append("SELECT *FROM ARMA ORDER BY DESC_TIPO_ARMA")

        Dim oReader As OleDbDataReader
        Dim lista As New Generic.List(Of armaVO)

        Try
            Dim oComando As New OleDbCommand(sql.ToString, objConn.abreConexao)
            oReader = oComando.ExecuteReader

            While oReader.Read
                arma = New armaVO
                arma.ID_TIPO_ARMA = IIf(IsDBNull(oReader("ID_TIPO_ARMA")), Nothing, oReader("ID_TIPO_ARMA"))
                arma.DESC_TIPO_ARMA = IIf(IsDBNull(oReader("DESC_TIPO_ARMA")), Nothing, oReader("DESC_TIPO_ARMA"))
                arma.TIPO_CANO = IIf(IsDBNull(oReader("TIPO_CANO")), Nothing, oReader("TIPO_CANO"))
                lista.Add(arma)
            End While

            Return lista
        Catch ex As Exception
            Throw ex
        Finally
            objConn.fechaConexao()
        End Try
    End Function
End Class
